//Sliding Effect Control
head.js("assets/js/skin-select/jquery.cookie.js");
head.js("assets/js/skin-select/skin-select.js");

//Showing Date
head.js("assets/js/clock/date.js");

//Bootstrap
//head.js("assets/js/bootstrap.js");

//NEWS STICKER
head.js("assets/js/newsticker/jquery.newsTicker.js", function() {

    var nt_title = $('#nt-title').newsTicker({
        row_height: 18,
        max_rows: 1,
        duration: 5000,
        pauseOnHover: 0
    });


});

//-------------------------------------------------------------

////Right Sliding menu

head.js("assets/js/slidebars/slidebars.min.js", function() {

    $(document).ready(function() {
        var mySlidebars = new $.slidebars();

        $('.toggle-left').on('click', function() {
            mySlidebars.toggle('right');
            new IScroll('.sub-right-part', { mouseWheel: true });
        });
    });
});

//-------------------------------------------------------------

//SEARCH MENU
head.js("assets/js/search/jquery.quicksearch.js", function() {

    $('input.id_search').quicksearch('#menu-showhide li, .menu-left-nest li');
   
   

});
//-------------------------------------------------------------

//-------------------------------------------------------------

//TOOL TIP

function initTootip() {
    head.js("assets/js/tip/jquery.tooltipster.js", function() {

        $('.tooltip-tip-x').tooltipster({
            position: 'right'

        });

        $('.tooltip-tip').tooltipster({
            position: 'right',
            animation: 'slide',
            theme: '.tooltipster-shadow',
            delay: 1,
            offsetX: '-12px',
            onlyOne: true

        });
        $('.tooltip-tip2').tooltipster({
            position: 'right',
            animation: 'slide',
            offsetX: '-12px',
            theme: '.tooltipster-shadow',
            onlyOne: true

        });
        $('.tooltip-top').tooltipster({
            position: 'top'
        });
        $('.tooltip-right').tooltipster({
            position: 'right'
        });
        $('.tooltip-left').tooltipster({
            position: 'left'
        });
        $('.tooltip-bottom').tooltipster({
            position: 'bottom'
        });
        $('.tooltip-reload').tooltipster({
            position: 'right',
            theme: '.tooltipster-white',
            animation: 'fade'
        });
        $('.tooltip-fullscreen').tooltipster({
            position: 'left',
            theme: '.tooltipster-white',
            animation: 'fade'
        });
        //For icon tooltip
        $('.tooltip-tip').addClass('tooltipster-disable');
    });

}
//------------------------------------------------------------- 

//NICE SCROLL

head.js("assets/js/nano/jquery.nanoscroller.js", function() {
    $(".nano").nanoScroller({
        //stop: true 
        scroll: 'top',
        scrollTop: 0,
        sliderMinHeight: 40,
        preventPageScrolling: true
        //alwaysVisible: false

    });

});
//------------------------------------------------------------- 






//------------------------------------------------------------- 
//PAGE LOADER
var paceOptions;
head.js("assets/js/pace/pace.js", function() {
    paceOptions = {
        ajax: false, // disabled
        document: false, // disabled
        eventLag: false, // disabled
        elements: {
            selectors: ['.my-page']
        }
    };

});

//-------------------------------------------------------------

//-------------------------------------------------------------

//DIGITAL CLOCK
head.js("assets/js/clock/jquery.clock.js", function() {

    //clock 差8小时
    $('#digital-clock').clock({
        offset: '+8',
        type: 'digital'
    });


});

var menuScroll;
function loadMenus() {
    ajaxs('./DMenu/getMenuTree', "GET", null, true,function(data) {
        $("#menuContainer").myMenu(data);
        // 渲染
        $(".topnav").accordionze({
            accordionze: true,
            speed: 500,
            closedSign: '<img src="assets/img/plus.png">',
            openedSign: '<img src="assets/img/minus.png">'
        });
        menuScroll = new IScroll('.skin-part', { mouseWheel: true });
        initTootip();
    })
}

function resizeMain() {
    // 自动跳转iframe的大小
    var navheadHeight = 75;
    var breadPadding = 20;
    var breadHeight = 25;
    var footHeight = 30;
    var windowHeight = $(window).height();
    //console.log("navheadHeight=" + navheadHeight + ",breadPadding=" + breadPadding + ",breadHeight=" + breadHeight + ",windowHeight=" + windowHeight);
    $("#contentFrm").css("height", windowHeight - navheadHeight - breadPadding - breadHeight - footHeight + "px");
    $(".sub-right-part").css("height", windowHeight - navheadHeight - footHeight + "px")
    $(".skin-part").css("height", windowHeight - navheadHeight - breadPadding - breadHeight - footHeight + 25 + "px");
}

$(document).ready(function(){
    loadMenus();
    $(".skin-part").css("overflow", "hidden");
    $(".sub-right-part").css("overflow", "hidden");
    resizeMain();
    window.onresize = function() {
        resizeMain();
    }
});

//-------------------------------------------------------------